package asbase
{
	import flash.display.Sprite;
	import flash.events.TimerEvent;
	import flash.utils.Timer;
	
	public class DiviceFrame extends Sprite
	{
		private var flag:int = 50000;
		
		private var index:int = 0;
		
		private var timer:Timer;
		
		private var frameExe:int = 1000;
		
		private var currentFlag:int = 0;
		
		public function DiviceFrame()
		{
			super();
			draw();
			exeCode();
			timer = new Timer(100);
			timer.addEventListener(TimerEvent.TIMER,onTimer);
			timer.start();
		}
		
		private function onTimer(event:TimerEvent):void {
			trace("enterframe..............");
			exeCode();
		}
		
		private function draw():void {
			this.graphics.beginFill(0);
			this.graphics.drawRect(0,0,100,100);
			this.graphics.endFill();
		}
		
		private function exeCode():void {
			if(index*frameExe>flag) {
				this.timer.removeEventListener(TimerEvent.TIMER,onTimer);
				timer.stop();
				return;
			}
			for(var i:int=0;i<frameExe;i++) {
				currentFlag++;
				trace(index+"------------index-----------"+currentFlag);
			}
			index++;
		}
	}
}